package com.handinfo.uimenu.window;

import java.io.DataInputStream;

import javax.microedition.lcdui.Graphics;

import com.handinfo.engine.AbstractGameScreen;
import com.handinfo.engine.GameManager;
import com.handinfo.uimenu.UIAbstractWindow;
import com.handinfo.uimenu.UIListener;
import com.handinfo.uimenu.UIManager;
import com.handinfo.uimenu.UIMessageBox;
import com.handinfo.uimenu.UIPalette;
import com.handinfo.uimenu.UIPopmenu;
import com.handinfo.uimenu.UITools;
import com.handinfo.uimenu.UIWindowFactory;
import com.handinfo.util.Tools;

public class UIWanted extends UIAbstractWindow
{
	
	//通缉令
	private static final short MAX_LINE = 7;//一页最大显示列表数
    private final String m_title_wanted = "通缉令";
    private final String m_title_publish = "我的发布";
	
	private String[] m_titleInfo;//需要显示的字符串数组
	private boolean m_isLeft;//左翻译箭头是否显示
	private boolean m_isRight;//左翻译箭头是否显示
	private int[] m_titleListx;//标题的位置x
	private int[] m_titleListy;//标题的位置y
	private int[] m_titleWidth;//各标题的宽度
	private boolean[] m_unitIsRoll;//单元区域是否需要滚动
	private int[] m_unitRollx;//单元区域的滚动
    
	private final int ROLL_STARTTIME = 20;//单元开始滚动的固定时间
	private final int ROLL_OVERTIME = 10;//单元滚动结束等待还原的固定时间
	private final int LIST_HELGHT = 184;//人员列表背景的高
	private final int LIST_RECT_H = 26; //单元人员列表的高 

	public String[][] m_infoList;//显示通缉人员的列表
	private long[] m_wantedID;//通缉令ID
	private long[] m_targetID;//目标ID
	private byte[] m_moneyType;//酬金类别：0游戏币，1元宝
	private byte m_sortType;//排序类别  0：NONE 1：元宝高低 2：金钱高低 3：时间高低  4：时间低高 
	private int m_rollState;//单元当前滚动状态  ：0开始等待 1滚动中 2滚动结束等待中
	private int m_frameCount = 0;//计算单元滚动时间 用帧数计算
	private int m_catchPage;//缓存翻页前页数 
	private int m_currIndex;//当前选中
	private int m_maxIndex;//当前页最大条数
	private short m_index_page;//当前选中页
	private short m_sum_page;//总页数
	private boolean isScreen;//绘制屏锁
	
	public UIWanted( int id )
	{
		super(id);
		setBounds(UITools.X_BG, UITools.Y_BG, UITools.W_BG, UITools.H_BG);
		initWanted();
	}	
    
	protected void initWanted(){
		switch(m_id){
			case UIWindowFactory.WINDOW_ID_WANTED://通缉令 
			case UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH://我的发布
				m_titleInfo = new String[3];
				m_titleInfo[0] = "通缉目标";
				m_titleInfo[1] = "酬金";
				m_titleInfo[2] = "时间";
				int length = m_titleInfo.length;
				m_titleWidth = new int[length];
				m_titleListx = new int[length];
				m_titleListy = new int[length];
				int _titleUnitWH = UITools.W_CONTENT/10;//内容框的单元宽度
				int[] Proportion  = {4,4,2};//对应的比例份额
				for( int i=0;i < length; i++ ){//计算各标题的宽度
				     m_titleWidth[i] = Proportion[i]*_titleUnitWH;
				     m_titleListy[i] = UITools.INITY_CONTENT;
				}

				int step = UITools.INITX_CONTENT + 1;
				for(int i=0;i<length;i++){//计算个标题的X
					m_titleListx[i] = step;
					step += m_titleWidth[i] + UITools.IW_RECT_CONTENT;
				}
				m_frameCount = 0;
				m_sortType = 0;//初始表示位为0
				m_catchPage = 0;
				m_currIndex = 0;
				m_maxIndex = 8;
				m_index_page = 0;
				m_sum_page = 0;
				m_isLeft =  false;
			    m_isRight = false;
				break;
			case UIWindowFactory.WINDOW_ID_WANTEDSEE://详细信息
				m_titleInfo = new String[5];
				m_titleInfo[0] = "通缉目标：";
				m_titleInfo[1] = "剩余时间：";
				m_titleInfo[2] = "赏金数额：";
				m_titleInfo[3] = "通缉榜文：";
				m_titleInfo[4] = "发布人：";
				length = m_titleInfo.length;
				step = UITools.INITX_CONTENT +1;
				m_titleWidth = new int[length];
				m_titleListx = new int[length];
				m_titleListy = new int[length];
				for( int i=0;i < length; i++ ){//计算各标题的宽度
				     m_titleWidth[i] = AbstractGameScreen.s_font.stringWidth(m_titleInfo[i]);
					 m_titleListx[i] = step;
				}			   
                step = UITools.INITY_CONTENT;
                for( int i=0;i< m_titleInfo.length -1;i++ ){
                	m_titleListy[i] = step;
                	step += UITools.H_PRE;
                }
                m_titleListy[4] = step + UITools.H_PRE;
				break;
		}
	}
	/** 主绘制逻辑 */
	protected void paintContent(Graphics g)
	{
		switch(m_id){
			case UIWindowFactory.WINDOW_ID_WANTED://通缉人员列表
				paintWantedList(g);
				break;
			case UIWindowFactory.WINDOW_ID_WANTEDSEE://查看信息
				paintWantedSee(g);
				break;
			case UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH://我的发布
				paintWantedMyPublish(g);
				break;
		}
		
	}
    


	/**
	 * 绘制通缉令列表
	 * */
	protected void paintWantedList(Graphics g){
		//绘制背景
		UITools.paintBackGround(g, m_x, m_y, m_w, m_h, m_title_wanted) ;
		//绘制标题
		paintWantedTitleList(g, m_titleInfo,m_x, m_y);
		//绘制通缉令人员
		paintWantedRoleList(g, m_x, m_y);
		//绘制翻页
		if( m_sum_page != 0){
		    UITools.paintPage(g, m_x + (m_w >> 1), m_y + m_h - 12, m_index_page, m_sum_page);
		}
	}
	
	/**
	 * 绘制我的发布列表
	 * */
	protected void paintWantedMyPublish(Graphics g){
		//绘制背景
		UITools.paintBackGround(g, m_x, m_y, m_w, m_h, m_title_publish, false, true);
		//绘制标题
		paintWantedTitleList(g, m_titleInfo,m_x, m_y);
		//绘制通缉令人员
		paintWantedRoleList(g, m_x, m_y);
		
	}
	/** 绘制列表标题 */
	protected void paintWantedTitleList(Graphics g,String[] str, int x, int y){
		    if(str == null)
		    	return;
		    int length = str.length;
		    for(int i=0;i<length;i++){//绘制标题列表
		    	 UITools.drawListTitleItem(g, x + m_titleListx[i] , y + m_titleListy[i], m_titleWidth[i], LIST_RECT_H, str[i]);
		    }	       
	}
	
	/** 绘制信息标题 */
	protected void paintWantedInfosList(Graphics g,String[] str, int x, int y){
		    if(str == null)
		    	return;
		    int length = str.length;
		    for(int i=0;i<length;i++){//绘制标题列表
		    	 UITools.drawColorString(g, str[i], x + m_titleListx[i]+ ( m_titleWidth[i] >> 1 ), y + m_titleListy[i], 0xffffff, Graphics.TOP | Graphics.HCENTER);
		    }	       
	}
	
	/** 列表中绘制具体成员信息
	 * @param g
	 * @param ArrayList 绘制列表
	 * @param x y
	 * @param curPage  当前页数
	 *  */
	protected  void paintWantedRoleInfos(Graphics g,String[][] temp,int x,int y){
		if( isScreen || temp == null || temp.length < 1 ){
			return;
		}
		//Tools.debugPrintln("temp.length="+temp.length+";m_unitRollx.length="+m_unitRollx.length);
		int clipX = g.getClipX();
		int clipY = g.getClipY();
		int clipW = g.getClipWidth();
		int clipH = g.getClipHeight();
		int src_x = 0;
		int src_y = 0;
		for( int i=0;i< temp.length;i++ ){
			if( m_currIndex == i){
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_YESS));
			}else{
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS));
			}
			//Tools.debugPrintln("temp[i][j]="+temp[i]);
			for( int j=0;j<temp[i].length;j++ ){
				 src_x =  x + m_titleListx[j] + UITools.IW_RECT_CONTENT;
				 src_y = y + m_titleListy[j] + UITools.IH_RECT_CONTENT + (i+1)*LIST_RECT_H + (Math.abs(LIST_RECT_H -AbstractGameScreen.s_font.getHeight()) >> 1);
				g.setClip(src_x, src_y, m_titleWidth[j]- (UITools.IW_RECT_CONTENT << 1), LIST_RECT_H);
				switch(j){
					case 0://通缉目标名字			
						g.drawString(temp[i][j],  src_x - m_unitRollx[i], src_y, 0);					
						break;
					case 1://酬金类别为元宝时
						long Rmb = Long.parseLong(temp[i][j]);
						 if( m_moneyType[i] == 1 ){
					         UITools.paintMoneyRmb(g, src_x, src_y + ( (LIST_RECT_H - UITools.H_MONEY_GAME) >> 1 ), Rmb , m_titleWidth[j] - ( UITools.IW_RECT_CONTENT << 1 ));
						 }else{
						     UITools.paintMoneyGameGold(g, src_x, src_y + ( (LIST_RECT_H - UITools.H_MONEY_GAME) >> 1 ), Rmb, m_titleWidth[j] - ( UITools.IW_RECT_CONTENT << 1 ));
						 }
						break;
				    default:
						g.drawString(temp[i][j],  src_x, src_y, 0);
						break;
				}			
			}
			if ( m_currIndex == i ) {
				src_x = x + m_titleListx[0];
				src_y = y + m_titleListy[0] + UITools.IH_RECT_CONTENT + (i+1) * LIST_RECT_H
						+ UITools.GAP_EACH_LINE;
				g.setClip(0, 0, AbstractGameScreen.SCREEN_WIDTH, AbstractGameScreen.SCREEN_HEIGHT);
				UITools.drawSelectBox(g, src_x, src_y, UITools.W_CONTENT + ( UITools.IW_RECT_CONTENT << 1 ), LIST_RECT_H - 2);
			}
		}
		g.setClip(clipX, clipY, clipW, clipH);
	}
	
	/**
	 * 绘制通缉令名单
	 * */
	protected void paintWantedRoleList(Graphics g,int x,int y){
		//绘制底框
		if (m_titleInfo != null) {
			for (int i = 0; i < m_titleInfo.length; i++) {
				drawRectTeamListBG(g, x + m_titleListx[i], y + m_titleListy[i] + LIST_RECT_H + UITools.IH_RECT_CONTENT, m_titleWidth[i], LIST_HELGHT + 2);
			}
		}
		//Tools.debugPrintln("m_sum_page="+m_sum_page);
		if( m_sum_page == 0){//空列表
			int clipX = g.getClipX();
			int clipY = g.getClipY();
			int clipW = g.getClipWidth();
			int clipH = g.getClipHeight();
			g.setClip(0, 0, AbstractGameScreen.SCREEN_WIDTH, AbstractGameScreen.SCREEN_HEIGHT);
			String str = "没有信息";
		    UITools.drawColorString(g, str, m_x+ ((m_w - AbstractGameScreen.s_font.stringWidth(str)) >> 1), m_y + (m_h >> 1), UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS), 0);
			g.setClip(clipX, clipY, clipW, clipH);
		}else{
			//绘制通缉令人员名单
			paintWantedRoleInfos(g, m_infoList, m_x, m_y);
			int a = 1;
		}
	}
	
	/**
	 * 绘制当前选中人员的信息
	 * */
	private void paintWantedSee(Graphics g)
	{
		//绘制背景
		UITools.paintBackGround(g, m_x, m_y, m_w, m_h, "通缉令", false, true);
		//绘制标题
		paintWantedInfosList(g, m_titleInfo,m_x, m_y);
		//绘制内容
		paintTargetInfosList(g, m_infoList, m_x, m_y);
		
	}
	
	/**
	 * 绘制当前选中人员的信息内容
	 * */
	private void paintTargetInfosList(Graphics g,String[][] temp,int x,int y){
		if( temp == null || temp.length <= 0){
			return;
		}
		int clipX = g.getClipX();
		int clipY = g.getClipY();
		int clipW = g.getClipWidth();
		int clipH = g.getClipHeight();
		g.setClip(0, 0, AbstractGameScreen.SCREEN_WIDTH, AbstractGameScreen.SCREEN_HEIGHT);
		g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS));
		//前4位存在temp[1]中
		for(int i=0;i<temp[1].length;i++){
			int src_x =  x + m_titleListx[i]+ m_titleWidth[i]+(UITools.GAP_EACH_LINE<<1);
			int src_y =  y + m_titleListy[i];
			if(i == 2){//酬金
				long Rmb = Long.parseLong(temp[1][i]);
				 if( m_moneyType[0] == 1 ){
			         UITools.paintMoneyRmb(g, src_x, src_y + UITools.IH_RECT_CONTENT, Rmb , 0);
				 }else{
				     UITools.paintMoneyGameGold(g, src_x, src_y + UITools.IH_RECT_CONTENT, Rmb, 0);
				 }
			}else{
			  g.drawString(temp[1][i],  src_x, src_y, 0);
			}
		}
		//第5位榜文存在temp[2]中
		for(int i=0;i<temp[2].length;i++){
			g.drawString(temp[2][i],  x +(UITools.GAP_EACH_LINE << 3), y + m_titleListy[3] + (i+1)*UITools.H_PRE, 0);
		}
		//最后为发布者存在temp[0]中
		for(int i=0;i<temp[0].length;i++){
			g.drawString(temp[0][i],   x + m_titleListx[i]+ m_titleWidth[i]+(UITools.GAP_EACH_LINE<<1), y + m_titleListy[4], 0);
		}
		g.setClip(clipX, clipY, clipW, clipH);
	}
	/**
	 * 按键逻辑
	 * */
	protected void keyLogic()
	{
		m_currframeCount++;
		switch (m_id) {
			case UIWindowFactory.WINDOW_ID_WANTED://通缉令
				 unitRollx();
                 keyWantedLogic();
				break;
			case UIWindowFactory.WINDOW_ID_WANTEDSEE://查看信息
				 keyWantedSeeLogic();
				break;
			case UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH://我的发布
				keyWantedMyPublish();
				break;
		}
	}
    
	/**
	 * 列表界面按键逻辑
	 * */
	private void keyWantedLogic(){
		
		if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
			close();
	    }else{ 
			if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_UP)) {
				changUpIndex();
			}else if( AbstractGameScreen.haveKeyPressed( AbstractGameScreen.GK_DOWN ) ){
				changDownIndex();
			}else if( AbstractGameScreen.haveKeyPressed( AbstractGameScreen.GK_LEFT ) ){
				changLeftPage();
			}else if( AbstractGameScreen.haveKeyPressed( AbstractGameScreen.GK_RIGHT ) ){
				changRightPage();
			}
			else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT_SOFT)
				|| AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_A)) {
			String[] memberItems = new String[] { "1.查看信息", "2.查看目标",
					"3.查看位置", "4.加为仇敌", "5.接通缉令",
					"6.酬金排序", "7.时间排序","9.我的发布"};
			UIPopmenu win = (UIPopmenu) UIManager.getInstance().createWindow(UIWindowFactory.WINDOW_POPMENU);
			win.setPopmenus(memberItems);
			win.addListener(getFriendListSubmenuListener(win));
	    	}
		}
	}
	
	/**
	 * 我的发布按键逻辑
	 * */
	public void keyWantedMyPublish(){
		if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
			close();
			UIAbstractWindow win = UIManager.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_WANTED);
			win.setPaint(true);
	    }else{ 
			if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_UP)) {
				changUpIndex();
			}else if( AbstractGameScreen.haveKeyPressed( AbstractGameScreen.GK_DOWN ) ){
				changDownIndex();
			}else if( AbstractGameScreen.haveKeyPressed( AbstractGameScreen.GK_LEFT ) ){
				changLeftPage();
			}else if( AbstractGameScreen.haveKeyPressed( AbstractGameScreen.GK_RIGHT ) ){
				changRightPage();
			}
		}
	}
	
	/**
	 * 成员信息界面按键逻辑
	 * */
	private void keyWantedSeeLogic(){
		if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
			close();
			UIAbstractWindow win = UIManager.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_WANTED);
			win.setPaint(true);
	    }
	}
	
	public int  m_currframeCount;   
    private void unitRollx(){
    	if( m_unitIsRoll == null || m_unitRollx == null || m_currIndex >= m_unitIsRoll.length){
    		return;
    	}
    	if ( m_unitIsRoll[m_currIndex] ){//判断滚动处理  条件必须是当前选中的单元需要滚动
    			switch( m_rollState ){//当前需要滚动单元的状态
    				case 0://开始等待
    					if( m_frameCount == 0){
    						//m_frameCount = GameManager.getInstance().m_scene.m_frameCount; 
    						m_frameCount = m_currframeCount;
    					}else if( m_currframeCount - m_frameCount >= ROLL_STARTTIME ){
    						m_rollState = 1;
    						m_frameCount = 0;
    					}   					
    					break;
    				case 1://滚动中
    					if( m_unitRollx[m_currIndex] < m_titleWidth[0] - (UITools.IW_RECT_CONTENT << 1)){
    						m_unitRollx[m_currIndex]++;
    					}else{
    						m_rollState = 2;
    					}
    					break;
    				case 2://结束等待
    					if( m_frameCount == 0 ){
    						//m_frameCount = GameManager.getInstance().m_scene.m_frameCount;
    						m_frameCount = m_currframeCount;
    					}else if( m_currframeCount - m_frameCount>= ROLL_OVERTIME ){
    						m_rollState = 0;
    						m_frameCount = 0;
    						m_unitRollx[m_currIndex] = 0;
    					}  
    					break;
    			}
    	}
    	//判断如果当前选项离开充值便宜量
    	for( int i=0; i < m_unitRollx.length;i++){
    		if( m_unitRollx[i] != 0 && m_currIndex != i){
    			m_unitRollx[i] = 0;
    			break;
    		}
    	}
    }
	/**
	 * 好友界面监听
	 * @param win
	 * @return
	 */
	private UIListener getFriendListSubmenuListener(final UIPopmenu win)
	{
		return new UIListener() {

			public void actionPerformed()
			{
				long guid = -1;
				String name;
	                 if (AbstractGameScreen
						.haveKeyPressed(AbstractGameScreen.GK_KEY1)) {//查看信息
						    guid = getSelectWantedID();
						    if( guid != -1){
					    	    GameManager.getInstance().m_game_message.sendWantedSee(guid);
					         }
						UIManager.getInstance().removeWindow(win);
				}
				else if (AbstractGameScreen
						.haveKeyPressed(AbstractGameScreen.GK_KEY2)) {//查看目标
				    guid = getSelectTargetID();
				    if( guid != -1 ){
				    	GameManager.getInstance().m_game_message.sendAttInfos(guid);
				    }
				    UIManager.getInstance().removeWindow(win);
				}
				else if (AbstractGameScreen
						.haveKeyPressed(AbstractGameScreen.GK_KEY3)) {//查看位置
					guid = getSelectTargetID();
					name  = getSelectTargetName();
					Tools.debugPrintln("name="+name);
					if( guid != -1 && name != null ){
						GameManager.getInstance().m_game_message.sendChecTargetPosition(guid,name);
					}
					UIManager.getInstance().removeWindow(win);
				}
				else if (AbstractGameScreen
						.haveKeyPressed(AbstractGameScreen.GK_KEY4)) {//加为仇敌
					guid = getSelectTargetID();
		            name = getSelectTargetName();
					if( guid != -1 && name != null ){
				    	GameManager.getInstance().m_game_message.sendWantedAddEnemy(guid,name);
				    }
					UIManager.getInstance().removeWindow(win);
				}
				else if (AbstractGameScreen
						.haveKeyPressed(AbstractGameScreen.GK_KEY5)) {//接通缉令					
					   guid = getSelectWantedID();
					   if( guid != -1 ){
						   GameManager.getInstance().m_game_message.sendWantedRecv(guid);
					   }
					   UIManager.getInstance().removeWindow(win);
					    
				}
				else if (AbstractGameScreen
						.haveKeyPressed(AbstractGameScreen.GK_KEY6)) {//按酬金排序
                    selectSort(5);
					UIManager.getInstance().removeWindow(win);
				}
				else if (AbstractGameScreen
						.haveKeyPressed(AbstractGameScreen.GK_KEY7)) {//按时间排序
					selectSort(6);
					UIManager.getInstance().removeWindow(win);
				}
				else if (AbstractGameScreen
						.haveKeyPressed(AbstractGameScreen.GK_KEY8)) {//我的发布
					GameManager.getInstance().m_game_message.sendWantedMyPublishFilp((short)0,MAX_LINE);
					UIManager.getInstance().removeWindow(win);
				}
				else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_A)
						|| AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT_SOFT)) {
					int index = win.getCurrentIndex();

					switch (index) {
						case 0: // 查看信息
						    guid = getSelectWantedID();
						    if( guid != -1){
						    	GameManager.getInstance().m_game_message.sendWantedSee(guid);
						    }
							break;
						case 1: //查看目标
						    guid = getSelectTargetID();
						    if( guid != -1 ){
						    	GameManager.getInstance().m_game_message.sendAttInfos(guid);
						    }
							break;
						case 2: //查看位置
							guid = getSelectTargetID();
							name = getSelectTargetName();
							if( guid != -1 && name != null ){	
								GameManager.getInstance().m_game_message.sendChecTargetPosition(guid,name);
							}
							break;
						case 3: //加为仇敌
							guid = getSelectTargetID();
				            name = getSelectTargetName();
							if( guid != -1 && name != null ){
						    	GameManager.getInstance().m_game_message.sendWantedAddEnemy(guid,name);
						    }							
							break;
						case 4: //接通缉令
							guid = getSelectWantedID();
							if (guid != -1) {
								GameManager.getInstance().m_game_message.sendWantedRecv(guid);
							}
							break;
						case 5: //酬金排序
						case 6: //时间排序
							selectSort(index);
							break;
						case 7: //我的发布	
							GameManager.getInstance().m_game_message.sendWantedMyPublishFilp((short)0,MAX_LINE);
							break;
					}
					UIManager.getInstance().removeWindow(win);
				}
				else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
					UIManager.getInstance().removeWindow(win);
				}
			}
		};
	}
    
	/**
	 * 选择排序
	 * */
	private void selectSort(int _index){
		byte sort = (byte)(_index - 4);
		switch(m_sortType){
		   case 0:
			    sort <<= 1;
			    sort--;
				break;
		  case 1://元宝高到低
		  case 2://金币高到低
			  if( sort == 1 ){//选择的排序与当前一样，判断升降
				  sort = ( m_sortType == 1 )?(byte)2:(byte)1;
			  }else{
				  sort <<= 1;
				  sort--;
			  }
			  break;
		  case 3://时间高到低
		  case 4://时间低到高
			  if( sort == 2 ){//选择的排序与当前一样，判断升降
				  sort = ( m_sortType == 3 )?(byte)4:(byte)3;
			  }else{
				  sort <<= 1;
				  sort--;
			  }
			  break;
		}
		GameManager.getInstance().m_game_message.sendWantedFilp(sort,(short)0,MAX_LINE);
	}
	
	
	private void changUpIndex(){
		if( m_currIndex == 0 && m_index_page == 0 ){//最顶翻页
			return;
		}else{
			if( m_currIndex > 0 ){
				m_currIndex--;
			}else{
				if( m_index_page > 0 ){					
					/** 发送  */
				    m_catchPage = m_index_page;
					switch(m_id){
						case UIWindowFactory.WINDOW_ID_WANTED:
							GameManager.getInstance().m_game_message.sendWantedFilp( m_sortType,(short)(m_index_page - 1),MAX_LINE);
							break;
						case UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH:
							GameManager.getInstance().m_game_message.sendWantedMyPublishFilp((short)(m_index_page - 1),MAX_LINE);
							break;	
					}


				}
			}
		}
	}
	
	private void changDownIndex(){//最下翻页
			if ( m_currIndex >= m_maxIndex ) {//到最底了判断翻页
				if ( m_index_page  < m_sum_page - 1) {//可以翻页					
					/** 发送 */
					m_catchPage = m_index_page;
					switch(m_id){
						case UIWindowFactory.WINDOW_ID_WANTED:
							GameManager.getInstance().m_game_message.sendWantedFilp( m_sortType, (short)(m_index_page + 1),MAX_LINE);
							break;
						case UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH:
							GameManager.getInstance().m_game_message.sendWantedMyPublishFilp( (short)(m_index_page + 1),MAX_LINE);
							break;	
					}

				}else{//最后一页，翻到开始页
					/** 发送 */
					m_catchPage = m_index_page;
					switch(m_id){
						case UIWindowFactory.WINDOW_ID_WANTED:
							GameManager.getInstance().m_game_message.sendWantedFilp( m_sortType, (short)0, MAX_LINE);
							break;
						case UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH:
							GameManager.getInstance().m_game_message.sendWantedMyPublishFilp((short)0,MAX_LINE);
							break;	
					}
				}
				
			}else {
				if( ( m_currIndex + 1 ) < m_maxIndex){
				     m_currIndex++;
				}
			}
		
	}
	/** 左翻页 */
	private void changLeftPage(){
		if( m_index_page > 0 ){
			/** 发送 */
			m_catchPage = m_index_page;
			switch(m_id){
				case UIWindowFactory.WINDOW_ID_WANTED:
					GameManager.getInstance().m_game_message.sendWantedFilp( m_sortType, (short)(m_index_page - 1),MAX_LINE );
					break;
				case UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH:
					GameManager.getInstance().m_game_message.sendWantedMyPublishFilp( (short)(m_index_page - 1),MAX_LINE);
					break;	
			}
		}else{
			if( m_sum_page > 1 ){
				/** 发送 */
				m_catchPage = m_index_page;
				switch(m_id){
					case UIWindowFactory.WINDOW_ID_WANTED:
						GameManager.getInstance().m_game_message.sendWantedFilp( m_sortType,(short)(m_sum_page-1),MAX_LINE );
						break;
					case UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH:
						GameManager.getInstance().m_game_message.sendWantedMyPublishFilp((short)(m_sum_page-1),MAX_LINE);
						break;	
				}		
			}		
		}
	}
	/** 右翻页 */
	private void changRightPage(){
		if( m_index_page < m_sum_page -1 ){
			/** 发送 */
			m_catchPage = m_index_page;
			switch(m_id){
				case UIWindowFactory.WINDOW_ID_WANTED:
					GameManager.getInstance().m_game_message.sendWantedFilp( m_sortType,  (short)(m_index_page + 1),MAX_LINE );
					break;
				case UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH:
					GameManager.getInstance().m_game_message.sendWantedMyPublishFilp( (short)(m_index_page + 1),MAX_LINE );
					break;	
			}	
		}else{
			if(m_sum_page > 1){
				/** 发送 */
				m_catchPage = m_index_page;
				switch(m_id){
					case UIWindowFactory.WINDOW_ID_WANTED:
						GameManager.getInstance().m_game_message.sendWantedFilp( m_sortType,(short)0,MAX_LINE );
						break;
					case UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH:
						GameManager.getInstance().m_game_message.sendWantedMyPublishFilp((short)0,MAX_LINE);
						break;	
				}		
			}			
		}
	}
	
	/**
	 * 设置内容信息列表
	 * */
	public void setInfoList(String[][] temp){
		if( temp == null || temp.length <= 0 ){
			return;
		}
		if( m_infoList != null ){
		    m_infoList = null;
		}
 		m_infoList = temp;
		switch (m_id) {
			case UIWindowFactory.WINDOW_ID_WANTED:
			case UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH:
				m_maxIndex = m_infoList.length;
				if( m_maxIndex > MAX_LINE ){
					m_maxIndex = MAX_LINE;
				}
				if( m_index_page > 0 ){
					m_isLeft = true;
				}
				if( m_index_page < (m_sum_page - 1)){
					m_isRight = true;
				}
				break;
			case UIWindowFactory.WINDOW_ID_WANTEDSEE:
				if( temp[2] != null ){//根据通缉榜文的长度重置发布人的坐标Y
					m_titleListy[4] = m_titleListy[3] + (temp[2].length+1)*UITools.H_PRE;
				}
				break;
		}

	}
	
	/**
	 * 获得当前选中通缉令ID
	 * */
	private long getSelectWantedID(){
		long guid = -1;
		if( m_wantedID != null ){
			int i = m_currIndex;
			if( i < 0 || i > m_wantedID.length - 1){
				return -1;
			}
			guid = m_wantedID[i];
		}
		return guid;
	}
	/**
	 * 获得当前选中目标ID
	 * */
	private long getSelectTargetID(){
		long guid = -1;
		 if( m_targetID != null ){
		    	int i = m_currIndex;
		    	if( i < 0 ||i > m_targetID.length - 1){
		    		return -1;
		    	}
		    	guid = m_targetID[i];
		    }
		return guid;
	}
	
	/**
	 * 获得当前选中目标的名字
	 * */
	private String getSelectTargetName(){
		String temp = null;
		int i = m_currIndex;
    	if( i < 0 ||i > m_targetID.length - 1){
    		return null;
    	}
    	temp = m_infoList[i][0];
		return temp;
	}
	
	/**
	 * 绘制队员信息列表 一列
	 * @param g
	 * @param x
	 * @param y
	 * @param w
	 * @param h
	 * @param data
	 * @param type
	 */
	private void drawRectTeamListBG(Graphics g, int x, int y, int w, int h)
	{
		UITools.drawListFrame(g, x, y, w, h);
		g.setClip(x, y, w, h);
		for (int i = 0; i < LIST_HELGHT / LIST_RECT_H ; i++) {
//			if (i == m_currIndex) {			
//				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_CBD_SELECT));
//				g.fillRect(x + 2, y + 2 + LIST_RECT_H * i, w - 4, LIST_RECT_H-3);
//			}
//			else 
			if ( (i & 1) == 0) {
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_CBD_DEEP));
				g.fillRect(x + 2, y + 2+ LIST_RECT_H * i, w - 4, LIST_RECT_H);
			}
			else {
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_CBD_LIGHT));
				g.fillRect(x + 2, y + 2 + LIST_RECT_H * i, w - 4, LIST_RECT_H);
			}
		}
	}

	
	/**
	 * 根据接受的人员信息创建窗体
	 * */
	public static final void recvWantedInfos(DataInputStream dis)
	{
		try{
			Tools.debugPrintln("recvWantedInfos");
	        boolean flag = false;
			UIWanted window = (UIWanted)UIManager.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_WANTED);
			if( window == null ){
				flag = true;
			    window = (UIWanted)UIWindowFactory.createWindow(UIWindowFactory.WINDOW_ID_WANTED);
			}
			window.isScreen = true;
			byte state = dis.readByte();//状态  0：成功 1：页号错误
	        if( state == 1 ){
	        	Tools.debugPrintln("页号错误 ERROR"+";state="+state);
	    		GameManager.getInstance().m_game_message.unlockNetwork();
	    		window.isScreen = false;
	        	return;
	        }
	        short sum_page = dis.readShort();//总页数
	        if( sum_page == 0 ){
	        	Tools.debugPrintln("总页数为0 ERROR");
	        	GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_B, "没有通缉令！");
	    		GameManager.getInstance().m_game_message.unlockNetwork();
	    		window.isScreen = false;
	        	return;
	        }
			window.m_sortType = dis.readByte();//排序类型
			window.m_sum_page = sum_page;//总页数
			window.m_index_page = dis.readShort();//当前页数
			Tools.debugPrintln("总页数="+window.m_sum_page+";当前页数="+window.m_index_page);
			short length = dis.readShort();//当前页通缉令数量
			if( length < 1 ){
				Tools.debugPrintln("通缉令数错误 ");
	    		GameManager.getInstance().m_game_message.unlockNetwork();
	    		window.isScreen = false;
				return;
			}
			if( length > MAX_LINE ){
				length = MAX_LINE;
			}
	        
			if( !flag ){
				window.m_wantedID = null;
				window.m_targetID = null;
				window.m_moneyType = null;
				window.m_unitIsRoll = null;
				window.m_unitRollx = null;
			}
			window.m_wantedID = new long[length];//通缉令id
			window.m_targetID = new long[length];//通缉目标id
			window.m_moneyType = new byte[length];//赏金类型
			window.m_unitIsRoll = new boolean[length];//是否需要滚动
			window.m_unitRollx = new int[length];//滚动偏移量
			String[][] temp = new String[length][3];
			for(short i=0;i<length;i++){
				window.m_wantedID[i] = dis.readLong();
				window.m_targetID[i] = dis.readLong();
				temp[i][0] = dis.readUTF();//通缉目标名字
				//Tools.debugPrintln("name["+i+"]="+temp[i][0]);
				//如果当前目标名字的长度大于显示框体设置需要滚动
				if( AbstractGameScreen.s_font.stringWidth(temp[i][0]) > (window.m_titleWidth[0] - (UITools.IW_RECT_CONTENT << 1 )) ){
				    window.m_unitIsRoll[i] = true;
				}else{
					window.m_unitIsRoll[i] = false;
				}
				window.m_unitRollx[i] = 0;//单元的滚动偏移量
				window.m_moneyType[i] = dis.readByte();//酬金类型
				int a = 1;
				if( window.m_moneyType[i] == 0){
					a = 100;
				}
				temp[i][1] = ""+dis.readLong()/a/a;//金额
				
				int souts = 0;
				int freeTime = dis.readInt();
				int hour = freeTime/3600;//小时数
				souts = freeTime%3600;//去小时后还有多少秒
				int minute = souts/60;//多少分钟
//				souts %= 60;//去分钟后剩余秒数
//				int seconds = souts;
				StringBuffer buff = new StringBuffer();
	            if ( hour < 10 ){
	                buff.append("0"+hour+":");
				}else{
					buff.append(hour+":");
				}	
			    
				if( minute < 10 ){
					//buff.append("0"+minute+":");
					buff.append("0"+minute);
				}else{
					buff.append(minute+":");
				}
				
//				if( seconds < 10 ){
//					buff.append("0"+seconds);
//				}else{
//					buff.append(seconds);
//				}
				temp[i][2] = buff.toString();//时间
				buff = null;
	  		}
			if( window.m_catchPage != window.m_index_page ){//不同页改变当前选择位置
				if( window.m_index_page == 0 && window.m_catchPage == window.m_sum_page - 1){//如果操作时从最有一页下翻到开始
					window.m_currIndex = 0;	
				}else if( window.m_catchPage > window.m_index_page ){//上翻
					window.m_currIndex = temp.length - 1;
				}else{//下翻
					window.m_currIndex = 0;				
				}
			}

			window.setInfoList(temp);
			temp = null;
			if( flag ){
		 		UIManager.getInstance().addWindow(window);
			}
			dis.close();
			dis = null;
			GameManager.getInstance().m_game_message.unlockNetwork();		
			window.isScreen = false;
		}catch (Exception e) {
			GameManager.getInstance().m_game_message.unlockNetwork();	
			Tools.debug(e);
		}
		
	}
	
	
	/**
	 * 根据接收的通缉令信息创建窗体
	 * */
	public static final void recvWantedSeeInfos(DataInputStream dis)
	{
		try{
			Tools.debugPrintln("recvWantedTargetInfos");
			UIWanted window = (UIWanted)UIWindowFactory.createWindow(UIWindowFactory.WINDOW_ID_WANTEDSEE);		
		    String[][] temp = new String[3][1];
		    String[] s = new String[3];
			String str = dis.readUTF();
			temp[0] = new String[]{str};//发布的名字
			s[0] = dis.readUTF();//通缉目标的名字
		    int freeTime = dis.readInt();//通缉目标的时间
			int hour = freeTime/3600;
			int sounts = freeTime%3600;
			int minute = sounts/60;
//			sounts %= 60;
//			int seconds = sounts;
			StringBuffer buff = new StringBuffer();
	       if ( hour < 10 ){
	            buff.append("0"+hour+":");
			}else{
				buff.append(hour+":");
			}	
			
			if( minute < 10 ){
//				buff.append("0"+minute+":");
				buff.append("0"+minute);
			}else{
				buff.append(minute);
			}
			
//			if( seconds < 10 ){
//				buff.append("0"+seconds);
//			}else{
//				buff.append(seconds);
//			}
			s[1] = buff.toString();
			buff = null;
		    window.m_moneyType = new byte[1];
		    window.m_moneyType[0] = dis.readByte();//酬金类型
			int a = 1;
			if( window.m_moneyType[0] == 0){
				a = 100;
			}
		    s[2] = "" + dis.readLong()/a/a;//通缉目标的酬金
		    temp[1] = s;
		    s = null;
		    str = dis.readUTF();//通缉目标的榜文
		    Tools.debugPrintln("榜文："+str);
		    int catWidth = window.m_w - UITools.H_PRE;
		    temp[2] = Tools.getStrArray(str, AbstractGameScreen.s_font, catWidth);
			window.setInfoList(temp);
			temp = null;
			UIManager.getInstance().addWindow(window);
			UIAbstractWindow win = UIManager.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_WANTED);
			win.setPaint(false);
			dis.close();
			dis = null;
			GameManager.getInstance().m_game_message.unlockNetwork();		
		}catch (Exception e) {			
			GameManager.getInstance().m_game_message.unlockNetwork();
			Tools.debug(e);
		}	
	}
		
	/**
	 * 根据接收的指令判断添加仇敌是否成功
	 * */
	public static final void recvWantedAddEnemy(DataInputStream dis)
	{
		try {
			Tools.debugPrintln("recvWantedAddEnemy");
			short state = dis.readShort();
			String conntext = null;
			if( state == 0 ){
				 conntext = "操作失败";
			}else{
				conntext = dis.readUTF();
			}
			GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_B, conntext);
			dis.close();
			dis = null;
			GameManager.getInstance().m_game_message.unlockNetwork();
		}catch (Exception e) {
			GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_B, "操作失败");
			GameManager.getInstance().m_game_message.unlockNetwork();
			Tools.debug(e);
		}
		
	}
     

	/**
	 * 根据接收到的指令查看当前选中的位置
	 * */
    public static final void recvWantedCheckTargetPosition(DataInputStream dis)
    {
    	try {
    		Tools.debugPrintln("recvWantedCheckTargetPosition");
        	StringBuffer buff = new StringBuffer();
        	char n = Tools.CHANGE_ROW;
        	buff.append("目标："+dis.readUTF());
        	buff.append(n);
        	byte state = dis.readByte();
        	if( state == 0){
            	buff.append("状态：离线");
            	buff.append(n);
            	buff.append("位置：未知");
        	}else{
            	buff.append("状态：在线");
            	buff.append(n);
            	buff.append("位置："+dis.readUTF());
        	}
            UIMessageBox window = (UIMessageBox)UIWindowFactory.createWindow(UIWindowFactory.WINDOW_MESSAGEBOX);

    	    window.setMessage("查看位置", null, "返回",buff.toString());
    		window.setCloseListener();
    		UIManager.getInstance().addWindow(window);
    		dis.close();
    		dis = null;
    	    buff = null;
        	GameManager.getInstance().m_game_message.unlockNetwork();
		}
		catch (Exception e) {
			GameManager.getInstance().m_game_message.unlockNetwork();
			Tools.debug(e);
		}
    	
    }
	
    /**
     * 根据接收到的指令打开或者翻页到我的发布
     * */
    public static final void recvWantedMyPublishFilp(DataInputStream dis)
    {
    	try {
    		Tools.debugPrintln("recvWantedMyPublishFilp");
    		boolean flag = false;
    		UIWanted window =(UIWanted)UIManager.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH);
    		if( window == null ){
    			flag = true;
    			window = (UIWanted)UIWindowFactory.createWindow(UIWindowFactory.WINDOW_ID_WANTEDMYPUBLISH);
    		}
    		window.isScreen = true;
    		byte state = dis.readByte();//状态 
    		Tools.debugPrintln("state="+state);
    		if(state == 1){
    			Tools.debugPrintln("页码错误 ERROR");
    			GameManager.getInstance().m_game_message.unlockNetwork();
    			window.isScreen = false;
    			return;
    		}
    		short sum_page = dis.readShort();//总页数
    		if( sum_page == 0){
    			GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_B, "你没有发布任何消息！");
    			Tools.debugPrintln("总页数为0 ERROR");
    			GameManager.getInstance().m_game_message.unlockNetwork();
    			window.isScreen = false;
    			return;
    		}

    		window.m_sum_page = sum_page;
    		window.m_index_page = dis.readShort();
    		short length = dis.readShort();
    		if( !flag ){
    			window.m_moneyType = null;
    			window.m_unitIsRoll = null;
    			window.m_unitRollx = null;
    		}
    	    window.m_moneyType = new byte[length];
    		window.m_unitIsRoll = new boolean[length];
    		window.m_unitRollx = new int[length];
    		String[][] temp = new String[length][3];
    		for(int i=0;i<length;i++){
    			temp[i][0] = dis.readUTF();//名字
    			//如果当前目标名字的长度大于显示框体设置需要滚动
    			if( AbstractGameScreen.s_font.stringWidth(temp[i][0]) > (window.m_titleWidth[0] - (UITools.IW_RECT_CONTENT << 1 )) ){
    			    window.m_unitIsRoll[i] = true;
    			}else{
    				window.m_unitIsRoll[i] = false;
    			}
    			window.m_moneyType[i] = dis.readByte();//酬金类型0游戏币1元宝
				int a = 1;
				if( window.m_moneyType[i] == 0){
					a = 100;
				}
    			long money = dis.readLong()/a/a;//金额
    			temp[i][1] = ""+money;
    			int freeTime = dis.readInt();//总秒数
    			int hour = freeTime/3600;//小时
    			int souts = freeTime%3600;//去小时后的秒数
    			int minute = souts/60;//分钟
//    			souts%=60;//剩余秒数
//    			int seconds = souts;//秒数
    			StringBuffer buff = new StringBuffer();
               if ( hour < 10 ){
                    buff.append("0"+hour+":");
    			}else{
    				buff.append(hour+":");
    			}	
    			
    			if( minute < 10 ){
    				//buff.append("0"+minute+":");
    				buff.append("0"+minute);
    			}else{
    				buff.append(minute+":");
    			}
    			
//    			if( seconds < 10 ){
//    				buff.append("0"+seconds);
//    			}else{
//    				buff.append(seconds);
//    			}
    			temp[i][2] = buff.toString();//时间
    		}
    		if(window.m_catchPage != window.m_index_page){//不同页改变当前选择位置
    			if( window.m_index_page == 0 && window.m_catchPage == window.m_sum_page - 1){//如果操作时从最有一页下翻到开始
    				window.m_currIndex = 0;	
    			}else if( window.m_catchPage > window.m_index_page ){//上翻
    				window.m_currIndex = temp.length - 1;
    			}else{//下翻
    				window.m_currIndex = 0;
    			}
    		}
    		window.setInfoList(temp);
    		if( flag ){
    			UIManager.getInstance().addWindow(window);
    		}
    		UIAbstractWindow win = UIManager.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_WANTED);
    	    win.setPaint(false);
    		GameManager.getInstance().m_game_message.unlockNetwork();
    		window.isScreen = false;
		}
		catch (Exception e) {
			GameManager.getInstance().m_game_message.unlockNetwork();
			Tools.debug(e);
		}
    }
    /**
     * 接受通缉令
     */
	public static final void recvWantedRecv(DataInputStream dis)
	{
		try {
			Tools.debugPrintln("recvWantedRecv");
			byte state = dis.readByte();//状态 
			String temp;
			switch (state) {
				case 0:
					temp = "接收通缉令失败！";
					break;
				case 1:
					temp = "接受通缉令成功！";
					break;
				case 2:
					temp = "已经接受此通缉令！";
					break;
				case 3:
					temp = "通缉令不存在！";
					break;
				case 4:
					temp = "不能接通缉自己的通缉令！";
					break;
				case 5:
					temp = "任务列表已达上限！";
					break;
				default:
					temp = "接收通缉令失败！";
					break;
			}
			GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_B, temp);
			GameManager.getInstance().m_game_message.unlockNetwork();
		}
		catch (Exception e) {
			GameManager.getInstance().m_game_message.unlockNetwork();
			Tools.debug(e);
		}
	}
    
//    public static DataInputStream  testSee(){//TODO 删除
//    	System.out.println("testSee");
//		String person = "大脸猫";
//		String name= "Tom克鲁斯";
//		int  time = 21000;
//		byte type = 0;
//		long money = 90;
//		String text = "你他妈的主公不加血，有杀不出杀，有闪不出闪，有桃不吃桃，乐忠臣，兵内奸！";
//    	ByteArrayOutputStream baos = new ByteArrayOutputStream();
//		DataOutputStream dos = new DataOutputStream(baos);
//		try{
//			dos.writeUTF(person);
//			dos.writeUTF(name);
//			dos.writeInt(time);
//			dos.writeByte(type);
//			dos.writeLong(money);
//			dos.writeUTF(text);
//			ByteArrayInputStream das = new ByteArrayInputStream(baos.toByteArray());
//			DataInputStream dis = new DataInputStream(das);
//			dos.close();
//			baos.close();
//			baos = null;
//			dos = null;
//			return dis;	
//		}catch(IOException e){
//			e.printStackTrace();
//			return null;
//		}
//    }
    
//    public static DataInputStream  testAddEnemy(){//TODO 删除
//      short state = 0;
//      String info = "添加默默成功";
//  	    ByteArrayOutputStream baos = new ByteArrayOutputStream();
//		DataOutputStream dos = new DataOutputStream(baos);
//		try{
//			dos.writeShort(state);
//			dos.writeUTF(info);
//			ByteArrayInputStream das = new ByteArrayInputStream(baos.toByteArray());
//			DataInputStream dis = new DataInputStream(das);
//			dos.close();
//			baos.close();
//			baos = null;
//			dos = null;
//			return dis;
//		}catch (IOException e) {
//			e.printStackTrace();
//		      return null;
//		}
//    }
    
//    public static DataInputStream  testCheckPosition(){//TODO 删除
//        byte state = 1;
//        String info = "会飞的鱼";
//        String position = "中国 - 北京";
//        ByteArrayOutputStream baos = new ByteArrayOutputStream();
//  		DataOutputStream dos = new DataOutputStream(baos);
//  		try{
//  			dos.writeByte(state);
//  			dos.writeUTF(info);
//  			dos.writeUTF(position);
//  			ByteArrayInputStream das = new ByteArrayInputStream(baos.toByteArray());
//  			DataInputStream dis = new DataInputStream(das);
//  			dos.close();
//  			baos.close();
//  			baos = null;
//  			dos = null;
//  			return dis;
//  		}catch (IOException e) {
//  			e.printStackTrace();
//  		      return null;
//  		}
//      }
    
    
	/**
	 * 清理
	 * */
	protected void dispose(){
		this.m_titleInfo = null;
		this.m_titleWidth = null;
		this.m_titleListx = null;
		this.m_titleListy = null;
		this.m_moneyType = null;
		this.m_targetID = null;
		this.m_wantedID = null;
		this.m_infoList = null;
		this.m_unitIsRoll = null;
		this.m_unitRollx = null;
	}
}
